﻿@using WebApp.ViewModels.Manage
@{
    Layout = null;
}
<div id="sidebar">
    <ul>

        @{
            foreach (var pmenu in ViewBag.MenuList as IList<UserMenuModel>)
            {
                if (pmenu.Status == (int)enmMenuStatus.Hidden)
                {
                    continue;
                }
                if (pmenu.ChildMenus.Count > 0)
                {
                    <li class="@(pmenu.Menuid == ViewBag.ActiveMenu ? "submenu active open" : "submenu")">
                        <a href="@(string.IsNullOrEmpty(pmenu.Menuurl)?"#":Href(pmenu.Menuurl))"><i class="iconfont @pmenu.Menuicon"></i> <span>@pmenu.Menuname</span> <i class="arrow fa fa-chevron-right"></i></a>
                        <ul>
                            @foreach (var childmenu in pmenu.ChildMenus.Where(p => p.Status != (int)enmMenuStatus.Hidden))
                            {
                                if (childmenu.Menuid == ViewBag.ActiveMenu2)
                                {
                                    <li class="active"><a href="@(string.IsNullOrEmpty(childmenu.Menuurl) ? "#" : Href(childmenu.Menuurl))">@childmenu.Menuname</a></li>
                                }
                                else
                                {
                                    <li><a href="@(string.IsNullOrEmpty(childmenu.Menuurl) ? "#" : Href(childmenu.Menuurl))">@childmenu.Menuname</a></li>
                                }
                            }
                        </ul>
                    </li>
                }
                else
                {
                    if (pmenu.Menuid == ViewBag.ActiveMenu)
                    {
                        <li class="active">
                            <a href="@(string.IsNullOrEmpty(pmenu.Menuurl)?"#":Href(pmenu.Menuurl))">
                                <i class="iconfont @pmenu.Menuicon"></i> <span>@pmenu.Menuname</span>
                            </a>
                        </li>
                    }
                    else
                    {
                        <li><a href="@(string.IsNullOrEmpty(pmenu.Menuurl)?"#":Href(pmenu.Menuurl))"><i class="iconfont @pmenu.Menuicon"></i> <span>@pmenu.Menuname</span></a></li>
                    }
                }
            }
        }
    </ul>
</div>